<template>
	<view  >
		<!-- <view class="lz-status_bar">
		    <view class="lz-top_view"></view>
		</view> 
		<view class="kaoshi-head">
		    <view class="kaoshi-head-top">
		        <view class="kaoshi-head-left" @tap="$navigateBack">
		            <view class="iconfont icon-zuojiantou"></view>
		        </view>
		        <view class="kaoshi-head-m">考试规则</view>
		    </view>
		</view> -->
		<view class="rule-title">
			【{{title}}】{{exam_name}}
		</view>
		<view class="study-top-bom">
			<view>
				<text>{{current_exam.score}}0</text>
				<text>满分（分）</text>
			</view>
			<view>
				<text>{{current_exam.jige_score}}0</text>
				<text>及格（分）</text>
			</view>
			<view>
				<text>{{current_exam.givetime}}</text>
				<text>限时（分钟）</text>
			</view>
		</view>
		<view class="tishi">
			<text style="color: red;">*</text>
			<view>
				无论答题是否完成，倒计时器归零自动交卷
			</view>
		</view>
		<view style="height: 20rpx;background-color: #efefef;width: 100%;"></view>
		<view class="examrule-list-title">
			考试分{{current_exam.type_arr.length}}为部分
		</view>
		<view class="examrule-list" v-for="(item,index) in current_exam.type_arr" :key="index">
			<text>{{item[0]}}</text>
			<view>
				<text style="width: 50%;">{{item[2]}}分</text>
				<text style="width: 50%;text-align: right;">共{{item[2]}}题</text>
			</view>
		</view>
		
		<view class="rule-btn">
			<view @tap="goto_detail()" >
				开始答题
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				from_type:'',
				exam_name:'',
				type_text:'',
				end_time:'',
				title:'',
				current_exam: {},
				type:'',
			}
		},
		onLoad(opts){
			this.id=opts.id
			this.from_type=opts.from_type
			this.exam_name=opts.exam_name
			this.type_text=opts.type_text
			this.end_time=opts.end_time
			this.title=opts.title
			this.type=opts.type
			this.examBegin()
		},
		methods: {
			goto_detail() {
			    this.$openrul('/pages/examination/examinationList/detail?id=' + this.id + '&from_type=' + this.from_type + '&exam_name=' + this.exam_name + '&title=' + this.type_text + '&end_time=' + this.end_time)
			},
			async examBegin(){
				
                let res = await this.$myHttp.post({
                    url: this.$myHttp.urlMap.exam_begin,
                    data:{
                        exam_id:this.id
                    },
                    needLogin: true
                });
                if(res.code == 1){
                    let end_time = res.data.endtime
                    this.current_exam=res.data
					this.end_time=end_time
					console.log(JSON.stringify(res.data)+"222")
                }
            },
			
		}
	}
</script>

<style>
	
.rule-title{
	font-size: 40rpx;
	font-weight: 700;
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	margin: 50rpx 0;
}
.study-top-bom{
	width:93%;
	margin:0 auto;
	border-radius:20rpx;
	background:#fff;
	background-color: #F7F8FA;
	display: flex;
	flex-flow: row nowrap;
	justify-content: space-around;
	align-items: center;
	height: 160rpx;
	
	
}
.study-top-bom>view{
	display: flex;
	flex-flow: column wrap;
	align-items: center;
	justify-content: center;
	
}
.study-top-bom>view>text:nth-child(1){
	font-size: 40rpx;
	font-weight: 900;
}
.study-top-bom>view>text:nth-child(2){
	color: #9C9C9C;
	font-size: 27rpx;
	
}
.tishi{
	display: flex;
	flex-flow: row nowrap;
	width: 95%;
	margin: auto;
	margin-top: 20rpx;
	margin-bottom: 30rpx;
}
.tishi>view{
	font-size: 25rpx;
	color: #9C9C9C;
}
.rule-btn{  
	width: 100%;
	    border-top: 1rpx #efefef solid;
	    position: fixed;
	    bottom: 0;
	    height: 110rpx;
	   
	    display: flex;
	    justify-content: center;
	    align-items: center;
}
.rule-btn>view{
	border-radius: 50rpx;
	    width: 95%;
	    display: flex;
	    justify-content: center;
	    align-items: center;
	    margin: 10rpx auto;
	    auto: ;
	    position: fixed;
	    bottom: 0;
	    background-color: #38a7f9;
	    color: #ffffff;
	    font-size: 30rpx;
	    margin: 10rpx auto;
	    margin: 10rpx auto;
	    height: 90rpx;
	    font-size: 30rpx;
}
.examrule-list{
	width: 91%;
	    margin: 20rpx auto;
	    display: flex;
	    flex-flow: row nowrap;
	    justify-content: space-between;
	    font-size: 27rpx;
	    color: #9c9c9c;
}
.examrule-list>view{
		width: 30%;
	    display: flex;
	    
}    
.examrule-list-title{
	font-weight: 700;
	    width: 92%;
	    margin: 40rpx auto;
}


</style>
